package org.ch04.test02;

import java.lang.reflect.Field;

/**
 * @author CSY
 * @date 2025 - 03 - 28
 */
public class MainTest {
    public static void main(String[] args) {
        check(ChinaPeople.class);
    }

    /**
     * 根据传入参数，返回问候语
     * @param clazz 国家
     */
    private static void check(Class<?> clazz) {
        Field[] fields = clazz.getDeclaredFields();
        boolean bl = clazz.isAnnotationPresent(HelloAnnotation.class);
        if (!bl){
            System.out.println("未知注解 - 未知国家");
            return;
        }
        HelloAnnotation annotation = clazz.getAnnotation(HelloAnnotation.class);
        String content = annotation.content();
        System.out.println(content);
//        if (annotation != null) {
//            String content = annotation.content();
//            System.out.println(content);
//        }
    }
}
